$(function(){
    var rid = '';
    var url = window.location.href;
    if (url.indexOf('rid=') != -1) {
        rid = url.split('rid=')[1];
    }
    $('.button').click(function () {
        var content = $('.text').val();
        if (rid && content) {
            $.ajax({
                url: './i/home/image/oppugn',
                type: 'POST',
                data: { rid: rid, content: content },
                error: function (error) {

                },
                success: function (data) {
                    if (data.error_code == 0) {
                        alert('质疑成功，确定后跳转页面至信息尾页')
                        window.location.href = './info.html?rid=' + rid;
                    } else {
                        alert(data.error_msg);
                    }
                }
            })
        } else {
            alert('没有图片rid或质疑内容为空, 无法提交');
        }
    })
})